.make-row(@gutter: @grid-gutter-width) {
    position: relative;
    margin-left: (@gutter / -2);
    margin-right: (@gutter / -2);
    height: auto;
    .clearfix;
}

.loop-col(@class) {
    .col(@index) {
        @item: ~".@{grid-column-prefix}@{class}@{index}";
        .col((@index + 1), @item);
    }
    .col(@index, @list) when (@index =< @grid-columns) {
        @item: ~".@{grid-column-prefix}@{class}@{index}";
        .col((@index + 1), ~"@{list}, @{item}");
    }
    .col(@index, @list) when (@index > @grid-columns) {
        @{list} {
            float: left;
            flex: 0 0 auto;
            display: block;
        }
    }
    .col(1);
}

.loop-pull(@index) when (@index > 0) {
    .pull-@{index} {
        right: percentage((@index / @grid-columns));
    }
    .loop-pull(@index - 1);
}

.loop-push(@index) when (@index > 0) {
    .push-@{index} {
        left: percentage((@index / @grid-columns));
    }
    .loop-push(@index - 1);
}
.loop-offset(@index) when (@index > 0) {
    .offset-@{index} {
        margin-left: percentage((@index / @grid-columns));
    }
    .loop-offset(@index - 1);
}
.loop-order(@index) when (@index > 0) {
    .order-@{index} {
        order: @index;
    }
    .loop-order(@index - 1);
}
.loop-grid-columns(@index, @class) when (@index > 0) {
    .@{grid-column-prefix}@{class}@{index} {
        width: percentage((@index / @grid-columns));
    }
    .loop-grid-columns((@index - 1), @class);
}

.loop-grid-columns(@index, @class) when (@index =0) {
    .@{grid-column-prefix}@{class}@{index} {
        display: none;
    }
}

.make-grid(@class: ~'') {
    .loop-col(@class);
    .loop-grid-columns(@grid-columns, @class);
}
.make-pull-push-offset-order () {
    .loop-pull(@grid-columns);
    .loop-push(@grid-columns);
    .loop-offset(@grid-columns);
    .loop-order(@grid-columns);
}

.clearfix() {
    zoom: 1;
    &:before,
    &:after {
        content: "";
        display: table;
    }
    &:after {
        clear: both;
        visibility: hidden;
        font-size: 0;
        height: 0;
    }
}
